package com.hcw.skycloud.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.hcw.core.mybatis.PageForm;
import com.hcw.core.web.ResponseVo;
import com.hcw.skycloud.api.ArticalApi;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by huangchunwu on 2016/10/29.
 */
@Controller
public class IndexController {

    @Reference
    private ArticalApi articalApi;

    @RequestMapping("/indexData")
    @ResponseBody
    public ResponseVo getArticePageList(@RequestBody PageForm pageForm){
        ResponseVo responseVo = new ResponseVo();
        try {
            responseVo.setData(articalApi.getArticePageList(pageForm));
            responseVo.setSuccess(true);
        }catch (Exception e){
            responseVo.setSuccess(false);
            responseVo.setData(e.getStackTrace());
        }

        return responseVo;
    }

}
